<form class="layui-form seller-alone-form" method="post">
	<input type="hidden" name="id" value="{$info.id}">
	<input type="hidden" name="title" value="{$info.title}">
	{if $recommend}
	<div class="layui-form-item">
		<label class="layui-form-label"><i class="required-color">*</i>为您推荐：</label>
		<div class="layui-input-block">
			{volist name="recLists" id="vo"}
			<input type="checkbox" name="resource_id[]" value="{$vo['id']}" lay-skin="primary" title="{$vo.title}" lay-filter="child" {if condition="in_array($vo['id'], $recommend)"}checked{/if}>
			{/volist}
		</div>
	</div>
	{else/}
	<div class="layui-form-item">
		<label class="layui-form-label"><i class="required-color">*</i>为您推荐：</label>
		<div class="layui-input-block">
			{volist name="recLists" id="vo"}
			<input type="checkbox" name="resource_id[]" value="{$vo['id']}" lay-skin="primary" title="{$vo.title}" lay-filter="child">
			{/volist}
		</div>
	</div>
	{/if}
	<div class="layui-form-item" style="margin-top: 10px;">
		<div class="layui-input-block">
			{:jshopToken('resource_recommend')}
			<button type="button" class="layui-btn" lay-submit lay-filter="edit_resource">保存</button>
			<button onclick="javascript:history.back(-1)" type="reset" class="layui-btn layui-btn-primary">返回</button>
		</div>
	</div>
</form>
<script>
	layui.use('form', function () {
		var form = layui.form;
		//监听提交
		form.on('submit(edit_resource)', function (data) {
			JsPost("{:url('resource/recommend')}", data.field, function (res) {
				if (res.status) {
					layer.msg(res.msg, {time: 1300}, function () {
						window.location.href = "{:url('resource/lists')}";
					});
				} else {
					layer.msg(res.msg);
				}
			})
		});
	});
</script>
